using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ComponentFactory.Krypton.Toolkit;

namespace XemlInteractiveDesigner
{
    public partial class SettingsFrm : ComponentFactory.Krypton.Toolkit.KryptonForm
    {
        public SettingsFrm()
        {
            InitializeComponent();
            string s = Properties.Settings.Default.StoreFolder;
            
            kryptonCheckBoxBorderChrome.DataBindings.Add("Checked",Properties.Settings.Default, "AllowFormChrome");
            comboBoxStyle.DataBindings.Add("Text", Properties.Settings.Default, "Style");
            textBoxXemlStore.DataBindings.Add("Text", Properties.Settings.Default, "StoreFolder");
            textBoxTemplates.DataBindings.Add("Text", Properties.Settings.Default, "TemplateFolder");
        }

        private void kryptonButtonOk_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.OK;
            Properties.Settings.Default.Save();
            this.Close();
          
        }

        private void kryptonButtonCancel_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
            Properties.Settings.Default.Reload();
            this.Close();
        }

        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            switch (e.Node.Text)
            {
                case "Directories":
                    {
                        kryptonHeaderGroup2.Visible = false;
                      //  kryptonHeaderGroup2.Dock = DockStyle.Fill;
                        kryptonHeaderGroup1.Visible = true;
                        kryptonHeaderGroup1.Dock = DockStyle.Fill;

                        break;
                    }
                case "Appearance":
                    {
                        kryptonHeaderGroup1.Visible = false;
                        //  kryptonHeaderGroup2.Dock = DockStyle.Fill;
                        kryptonHeaderGroup2.Visible = true;
                        kryptonHeaderGroup2.Dock = DockStyle.Fill;
                        break;
                    }
                default:
                    break;
            }
        }

        private void kryptonButtonDirChooseStore_Click(object sender, EventArgs e)
        {
            folderBrowserDialogStore.SelectedPath = textBoxXemlStore.Text;
            if (folderBrowserDialogStore.ShowDialog() == DialogResult.OK)
                textBoxXemlStore.Text = folderBrowserDialogStore.SelectedPath;

        }

        private void kryptonButtonDirChoosTemplates_Click(object sender, EventArgs e)
        {
            folderBrowserDialogTemplates.SelectedPath = textBoxTemplates.Text;
            if (folderBrowserDialogStore.ShowDialog() == DialogResult.OK)
                textBoxTemplates.Text = folderBrowserDialogTemplates.SelectedPath;
        }
    }
}